<?php
require_once 'lib/controller.php';
require_once 'lib/LoggedIn.php';
require_once 'views/StandardView.php';
require_once 'db/AlertsDB.php';
require_once 'views/AlertsView.php';
require_once 'models/AlertsModel.php';
$loggedIn = new LoggedIn();
$standardView = new StandardView($html, $_GET, $db);
$contentDB = new AlertsDB($db);
$contentView = new AlertsView($html);
$contentModel = new AlertsModel($contentDB, $contentView, $helper, $_SESSION);

if(!$loggedIn->check()) {
    header('Location: /alertsIntro.php');
} else {
    $error = $contentModel->process  ($_POST);
    $content = $contentModel->render($_SESSION, $_POST, $error);
    $standardView->style('/css/alerts.css');
    $standardView->script('/js/jquery.tablesorter.min.js');
    $standardView->script('/js/alerts.js');
}
echo $standardView->render($content);
?>
